<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>dept_mag.jsp</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	<link rel="stylesheet" type="text/css" href="./css/style.css">

<SCRIPT type="text/javascript">
     function deleteRoom(){
			var id;			
			var c = document.getElementsByName("id");
			var i=0;
			for(i=0;i<c.length;i++){
				if(c[i].checked==true){
					id = c[i].value;
					break;
				}
			}
			if(id==null||id==""){
				alert("请选择后再进行删除操作！");
				return false;
			}else{
				if(confirm("确定要删除吗？")){
				
				 return true;
				}
				return false;
			}
		}

</SCRIPT>
  </head>
  
  <body>
    <div id="blue_button"><div id="blue_button_word">&nbsp;角色管理</div></div>
  <div id="right_background">
  &nbsp;
  <br> <br>
  <form action="role/DelRoleAction" method="post" onsubmit="return deleteRoom()">
  <table  class="tab_dept" border="1" >
  
  <tr class="tab_header">
  <td valign="middle" align="center">员工ID</td>
  <td valign="middle" align="center">员工姓名</td>
  <td valign="middle" align="center">所属部门</td>
  <td valign="middle" align="center" width="250px" >所配角色</td>
  <td valign="middle" align="center">具体权限值</td>
   <td valign="middle" align="center" >角色配置</td>
  
 
  
  </tr>
  <%int i=0; 
  List<String>dept =(List<String>) request.getAttribute("dept");
  List<List<String>> rolelist=(List<List<String>> )request.getAttribute("rolelist");
  %>
  <s:iterator var="emp" value="emplist" status="st">
  
   <tr  class="row2" onMouseOver="this.className='row1'"
			onMouseOut="this.className='row2'">
  <td valign="middle" align="center">${emp.EId}</td>
  
  <td valign="middle" align="center">${emp.EName}</td>
 
   <td valign="middle" align="center"><%=dept.get(i)%></td>
 
  
  <%if(rolelist.get(i).size()==0) {%>
  <td valign="middle" align="center">暂未配置角色</td>
  <%}else{%>
   <td valign="middle" align="center">
   <% for(String str :rolelist.get(i)){%>
    <%=str%>   &nbsp;
   <% } %>
   </td>
   <%} %>
  <td valign="middle" align="center">${emp.ERight}</td>
 
   <% i++;%>
  <td valign="middle" align="center" ><a href="role/ShowMappingAction?id=${emp.EId}">配置</a></td>

  
  
  </tr>
  </s:iterator>
  </table>
		<br>
         <s:if test="message==1">
		 　 　 　 　  <font color="red">配置成功</font>
		  </s:if>
		  
		
   
	</form>
	<p class="paging">
		<s:if test="%{page == 1}">
			&lt;&lt; 首页 &lt; 上一页
		</s:if>
		<s:else>
			<a href="./role/EmpRoleAction?page=1"> &lt;&lt;首页</a>
			<a href="./role/EmpRoleAction?page=${page-1}">&lt; 上一页 </a>
		</s:else>
	
		<strong>第${page}页/共${endpage}页</strong>
		<s:if test="%{page == endpage}">
			下一页 &gt;
			末页 &gt;&gt;
		</s:if>
		<s:else>
			<a href="./role/EmpRoleAction?page=${page+1}"> 下一页 &gt;</a>
			<a href="./role/EmpRoleAction?page=${endpage}">末页 &gt;&gt;</a>
		</s:else>
	</p>
  </div>
  
  </body>
</html>
